﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Employee.aspx.cs" Inherits="Web.Employee" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <div class="container-fluid">
      <div class="row-fluid">
        <div class="span3">
          <div class="well sidebar-nav">
            <ul class="nav nav-list">
              <li class="nav-header">พนักงาน</li>
              <li class="active"><a href="#">พนักงาน</a></li>
              <li><a href="#">พนักงาน</a></li>
              <li><a href="#">ลางาน</a></li>
              <li><a href="#">ใบสั่งงาน</a></li>
            </ul>
          </div><!--/.well -->
        </div><!--/span-->
        <div class="span9">            
          <asp:GridView ID="GridView1" runat="server" ShowHeaderWhenEmpty="True"
            AutoGenerateColumns="False" onrowdeleting="OnRowDeleting"
            OnRowCancelingEdit="OnRowCancelRecord" OnRowEditing="OnRowEditingRecord"
            OnRowUpdating="OnRowUpdateRecord" Width="700px"
                CssClass="table table-bordered" >
            <RowStyle HorizontalAlign="Center" />
 
            <Columns> 
                <asp:TemplateField>
                    <HeaderTemplate>Id</HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID ="lblId" runat="server" Text='<%#Bind("user_id")%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
 
                <asp:TemplateField>
                    <HeaderTemplate>User Type</HeaderTemplate>
                    <ItemTemplate>
                    <asp:Label ID="lblUserTypeId" runat ="server" Text='<%#Bind("user_type_id") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                    <asp:TextBox ID ="txtUserTypeId" runat="server" Text='<%#Bind("user_type_id") %>' MaxLength="10"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvtxtUserTypeId" runat="server" Text="*" ToolTip="Enter User Type" ControlToValidate="txtUserTypeId"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revtxtUserTypeId" runat="server" Text="*" ToolTip="Enter numeric value" ControlToValidate="txtUserTypeId" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator>
          
                    </EditItemTemplate>
                    <FooterTemplate>
                    <asp:TextBox ID="txtNewUserTypeId" runat="server" MaxLength="2"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvtxtNewUserTypeId" runat="server" Text="*" ToolTip="Enter age" ControlToValidate="txtNewUserTypeId"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revNewUserTypeId" runat="server" Text="*" ToolTip="Enter numeric value" ControlToValidate="txtNewUserTypeId" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator>
                    </FooterTemplate>
                </asp:TemplateField>

                <asp:TemplateField>
                    <HeaderTemplate>FullName</HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID ="lblName" runat="server" Text='<%#Bind("user_fullname") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtName" runat="server" Text='<%#Bind("user_fullname") %>' MaxLength="50">
                        </asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvtxtName" runat="server" Text="*" ToolTip="Enter name" ControlToValidate="txtName"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="revtxtName" runat="server" Text="*" ToolTip="Enter alphabate " ControlToValidate="txtName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator>
                    </EditItemTemplate>
                    <FooterTemplate>
                        <asp:TextBox ID="txtNewName" runat="server" MaxLength="50"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvtxtNewName" runat="server" Text="*" ToolTip="Enter name" ControlToValidate="txtNewName"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="revtxtNewName" runat="server" Text="*" ToolTip="Enter alphabate " ControlToValidate="txtNewName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator>
                    </FooterTemplate>
                </asp:TemplateField>
           
                <asp:TemplateField>
                    <HeaderTemplate>LoginName</HeaderTemplate>
                    <ItemTemplate>
                    <asp:Label ID="lblLoginName" runat ="server" Text='<%#Bind("user_login_name") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                    <asp:TextBox ID ="txtLoginName" runat="server" Text='<%#Bind("user_login_name") %>' MaxLength="10"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvtxtLoginName" runat="server" Text="*" ToolTip="Enter LoginName" ControlToValidate="txtLoginName"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revtxtLoginName" runat="server" Text="*" ToolTip="Enter value" ControlToValidate="txtLoginName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator>
          
                    </EditItemTemplate>
                    <FooterTemplate>
                    <asp:TextBox ID="txtNewLoginName" runat="server" MaxLength="10"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvtxtNewLoginName" runat="server" Text="*" ToolTip="Enter LoginName" ControlToValidate="txtNewLoginName"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="revNewtxtLoginName" runat="server" Text="*" ToolTip="Enter numeric value" ControlToValidate="txtNewLoginName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator>
                    </FooterTemplate>
                </asp:TemplateField>
 
                <asp:TemplateField>
                    <HeaderTemplate>Password</HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label ID = "lblPassword" runat="server" Text='<%#Bind("user_password") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtPassword" runat="server" Text='<%#Bind("user_password") %>' MaxLength="10"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvtxtPassword" runat="server" Text="*"  ToolTip="Enter Password" ControlToValidate="txtPassword"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="revtxtPassword" runat="server" Text="*" ToolTip="Enter numeric value" ControlToValidate="txtPassword" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator>
          
                    </EditItemTemplate>
                    <FooterTemplate>
                        <asp:TextBox ID="txtNewPassword" runat="server" MaxLength="10"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="rfvtxtNewPassword" runat="server" Text="*"  ToolTip="Enter Password" ControlToValidate="txtNewPassword"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="revtxtNewPassword" runat="server" Text="*" ToolTip="Enter numeric value" ControlToValidate="txtNewPassword" ValidationExpression="^[a-zA-Z'.\s]{1,40}$"></asp:RegularExpressionValidator>
                    </FooterTemplate>
                </asp:TemplateField>
 
                <asp:TemplateField>
                <HeaderTemplate>Operation</HeaderTemplate>
                <ItemTemplate>
                <asp:Button ID="btnEdit" CssClass="btn btn-primary" runat="server" CommandName="Edit" Text="Edit" />
                <asp:Button ID="btnDelete" CssClass="btn btn-danger" runat="server" CommandName="Delete" Text="Delete" CausesValidation="true" OnClientClick="return confirm('Are you sure?')" />
                </ItemTemplate>
                <EditItemTemplate>
                <asp:Button ID="btnUpdate" CssClass="btn btn-info" runat="server" CommandName="Update" Text="Update" />
                <asp:Button ID="btnCancel" CssClass="btn btn-info" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="false" />
                </EditItemTemplate>
 
                <FooterTemplate>
                <asp:Button ID="btnAddNew" CssClass="" runat="server" Text="Insert" OnClick="btnAddNew_Click"/>
                <asp:Button ID="btnAddNewCancel" runat="server" Text="Cancel" OnClick="btnAddNewCancel_Click" CausesValidation="false" />
                </FooterTemplate>
 
           
                </asp:TemplateField>
 
           
                </Columns>
                <EmptyDataTemplate>
                          No record available
                     
                </EmptyDataTemplate>
        </asp:GridView>
        <br/>
        <asp:Button ID="btnAddNewRecord" runat="server" Text="Add New Record" onclick="btnAddNewRecord_Click" />
            <asp:Button id="btnTest" runat="server" Text="Button" OnClick="btnTest_Click"/>
        </div><!--/row-->
      </div><!--/span-->
    </div><!--/row-->
</asp:Content>

<asp:Content ID="BodyContent" ContentPlaceHolderID="BodyContent" runat="server">
    
</asp:Content>

